import request, { POST } from "../util/request";
import share from "../util/commnet";
import axios from 'axios'

const k = share.dir


// 获取管理类型时间段统计数据的接口      type:"类型|token|uuid|手机号"
export const managementStaticAPI = (type) => POST(k + '/management', { type });

// 单张图片审核
export const imageAPI = (type, files = []) => {
    let formData = new FormData();
    formData.append('type', type);

    if (Array.isArray(files)) { // 如果是多个文件
        files.forEach((file, index) => {
            formData.append(`file[${index}]`, file);
        });
    } else { // 单个文件
        formData.append('file', files);
    }

    return POST(share.http + k + '/image', formData);
}


// 技师身份证识别
export const idCardAPI = (type, files = []) => {
    let formData = new FormData();
    formData.append('technician', type);
    // 将文件数组依次添加到formData中
    // for (let i = 0; i < files.length; i++) {
        formData.append(`IDcard`, files);
    // }
    return POST(share.http +'/technicianAjax/Identity',formData);
    // '',{'Content-Type': 'multipart/form-data'}
}


// 技师
export const techStatAPI = (type) => POST(k + '/tech', { type });


// 用户
export const userDataAPI = (type) => POST(k + '/userData', { type });


// 流水
export const logsAPI = (type) => POST(k + '/logs', { type });


//订单
export const ordergAPI = (type) => POST(k + '/orderg', { type });

// 退款
export const deductAPI = (type) => POST(k + '/deduct', { type });

// 代理
export const superiorAPI = (type) => POST(k + '/superior', { type });





